package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Category;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.myannotation.MyAutoFill;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.ArrayList;
import java.util.List;

public interface DishMapper {

    List<Dish> findCategoryById(ArrayList<Long> ids);

    @MyAutoFill(OperationType.INSERT)
    void addDish(Dish dish);

    Page<Dish> queryPage(DishPageQueryDTO dishPageQueryDTO);

    @Select("select * from dish where category_id = #{categoryId}")
    List<Dish> findDishCateGoryById(Long categoryId);

    @MyAutoFill(OperationType.UPDATE)
    void updateDish(Dish dish);


    @Select("select * from dish where id = #{id}")
    Dish queryDishById(Long id);

    void delDishByIds(List<Long> ids);

    List<Dish> findDishCateGoryByIds(List<Long> ids);

    List<Dish> list(Dish dish);
}
